home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™94 / Talks & Papers / Timothy Knox / Help / Help Files / Foreign Code / Fib-init < prev    next >
Text File  |  1994-06-24  |  921b  |  28 lines

  1. {••• The following expression LOADS the CODE for Fibonnacci as compiled
  2.      by Help compiler… then hand-translated to MPW Asm… All the files
  3.      from compiler generation to final code are in this directory •••}
  4.  
  5. ;;; ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  6. ;;; ------> PAY ATTENTION TO THE PATH GIVEN in 4th line ! <-----
  7. ;;; ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  8. ;;; If it isn't correct, it won't work, and you will get an i/o error
  9.  
  10. (begin 
  11.     (define (fib n))
  12.  (define xref (force (cell 'fib <? 2 1 + fib 1- - ƒ)))
  13.  (define e (getext xref "Fib" ":Help Files:Foreign Code:foreign"))
  14.  (coerce fib (type '(a b)))
  15.  (car=! fib e)
  16.  (cdr=! fib ())
  17.  (print fib)
  18.  (masgc)
  19.  (coerce fib 12)
  20.  (setstrict fib %1))
  21.  
  22. {••• Try it… 
  23.      Timing is on a MacIntosh emulated on an Amiga 2000 (68030/25Mhz) •••}
  24.  
  25. (chrono (fib 20))
  26. { = [10946  1.150000000000000000e+0  0.000000000000000000e+0] }
  27.  
  28.